home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / os2 / epmgcc30.zip / GCCPARSE.E < prev    next >
Text File  |  1996-07-06  |  3KB  |  73 lines

  1. /*
  2. ╔══════════════════════════════════════════════════════════════════════════════╗
  3. ║ What's it called: EPMGCC  V3.00                                              ║
  4. ║                                                                              ║
  5. ║ What does it do:  The E source code for the GCC-Interface for EPM.           ║
  6. ║                   This file contains the code for the error parser of        ║
  7. ║                   compile time errors issued by gcc (infomational messages   ║
  8. ║                   and linker errors are skipped).                            ║
  9. ║                   This module is linked seperately to allow the user to      ║
  10. ║                   change the error-parser during runtime. See the            ║
  11. ║                   documentation for details.                                 ║
  12. ║                                                                              ║
  13. ║ Who and When:     B. Bablok 12/93 - 07/96                                    ║
  14. ║                                                                              ║
  15. ╚══════════════════════════════════════════════════════════════════════════════╝
  16. */
  17. DEFC gcc_parse_error =
  18.    UNIVERSAL gcc_error_file_id, gcc_other_file_id, gcc_error_file,
  19.              gcc_line2index, gcc_index2err, gcc_error_index
  20.  
  21.    parse_all = ARG(1) <> ''
  22.    error_no = 0
  23.    col      = 1                        -- gcc gives no info on column of error
  24.    WHILE (.line <= .last) DO           -- iterate until a "true" error is found
  25.      GETLINE  line
  26.  
  27.       IF POS(":",WORD(line,1)) = 0 THEN
  28.          lineno = 'junk'
  29.       ELSEIF SUBSTR(line,2,1) = ":" THEN
  30.          PARSE VALUE line WITH drive ":" filename ":" lineno ":" gcc_message
  31.          filename = drive":"filename
  32.       ELSE
  33.          PARSE VALUE line WITH filename ":" lineno ":" gcc_message
  34.       ENDIF
  35.  
  36.      IF NOT ISNUM(lineno) THEN
  37.        IF .line = .last THEN
  38.           IF NOT parse_all THEN
  39.              ACTIVATEFILE gcc_other_file_id
  40.              SAYERROR "No more errors!"
  41.           ELSE
  42.              DO_ARRAY 2, gcc_line2index, 0, error_no
  43.              DO_ARRAY 2, gcc_index2err, 0, error_no
  44.           ENDIF
  45.           RETURN
  46.        ELSE                           -- try the next line
  47.          "+1"
  48.        ENDIF
  49.  
  50.      ELSEIF NOT parse_all THEN                              -- found an error
  51.        "EDIT" TRANSLATE(filename,'\','/') "'"lineno"'"
  52.        SAYERROR gcc_message
  53.        RETURN
  54.  
  55.      ELSE
  56.        error_no = error_no + 1
  57.        DO_ARRAY 2, gcc_line2index, .line, error_no
  58.        DO_ARRAY 2, gcc_index2err, 'line.'error_no, lineno
  59.        DO_ARRAY 2, gcc_index2err, 'col.'error_no, col
  60.        DO_ARRAY 2, gcc_index2err, 'file.'error_no, filename
  61.        DO_ARRAY 2, gcc_index2err, 'msg.'error_no, gcc_message
  62.        line = .line
  63.        DO_ARRAY 2, gcc_index2err, 'orig.'error_no, line
  64.        IF .line = .last THEN
  65.           DO_ARRAY 2, gcc_line2index, 0, error_no
  66.           DO_ARRAY 2, gcc_index2err, 0, error_no
  67.           RETURN
  68.        ELSE
  69.          "+1"
  70.        ENDIF
  71.      ENDIF
  72.    ENDWHILE
  73.